9. Jupyter Book rendering demo

JupyterBook allows for rendering of notebooks as static HTML that can be rendered on github pages. This notebook demonstrates some of the more advanced rendering available within a notebook that doesn’t require a kernel back-end.

This notebook is therefore a demo of the potential benefits that could be gained if Max Fordham rendered project information in website form.

9.1. Datafames

9.1.1. Scrollable rows and columns

import pandas as pd
import numpy as np
import seaborn as sns

bigdf = pd.DataFrame(np.random.randn(16, 100))
bigdf.style.set_sticky(axis="index")
bigdf.index = pd.MultiIndex.from_product([["A","B"],[0,1],[0,1,2,3]])
bigdf.style.set_sticky(axis="index", pixel_size=18, levels=[1,2])
      0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
A 0 0 -0.875727 0.993919 -1.211893 -0.855388 1.776684 -1.062215 -0.985909 -0.478208 0.552892 -0.927784 0.506459 -0.101090 -0.633454 0.600721 0.831264 -0.089678 1.405244 -0.351791 -0.293225 -0.106222 2.559927 0.002794 -0.284171 0.208286 -0.522078 1.039464 -0.078363 -0.011758 0.396503 0.577731 0.249495 0.064872 1.068988 -0.068914 -1.194042 -1.622583 -0.687725 -0.750798 -1.387517 0.454535 -2.224124 -1.412412 -1.858907 1.821588 -0.626103 -0.911866 0.853091 -0.446863 0.201738 -0.063575 -1.170795 -1.064078 0.364606 -1.664326 0.529291 0.042706 0.237570 0.268118 -1.058659 0.815817 0.103583 -2.002289 -0.576954 0.840417 -1.757370 1.362948 0.533707 -1.555560 -0.552956 -0.251933 -1.229880 -0.583146 -0.384834 -0.025578 -0.137210 0.491120 0.931430 -0.181915 -1.062576 -0.675397 -0.486235 1.669154 0.827952 -0.550040 0.637623 -1.569921 -1.256088 -0.996217 0.006317 -1.889145 -0.674110 0.897477 -0.868341 0.114185 -1.935101 -1.142703 -1.041678 -0.477598 -0.827999 1.681702
1 -0.565226 -0.110377 1.507730 0.230881 0.384553 -0.026967 0.792935 0.324517 1.111878 -0.361931 -1.421612 0.403211 1.276649 1.688077 0.582302 0.026692 -0.884678 0.194881 0.587501 -0.549716 -0.770720 1.414605 0.494523 -0.593667 0.604794 -0.211878 0.418193 -0.018376 0.549334 1.215063 3.290993 -0.023329 0.707201 -0.553077 0.289139 -0.012315 -0.011500 -1.499957 -1.266898 0.738293 -0.765495 -0.345950 0.655406 0.934934 1.004122 -0.459277 0.295399 0.268653 -1.357069 -0.863663 0.100232 -0.481980 0.183086 -0.055798 -0.091628 1.057405 -0.852444 -2.380912 2.765157 0.494264 -0.951223 -0.084700 -0.028066 -0.278312 0.616265 1.389775 0.828357 -0.312519 0.670040 -0.594061 2.096954 -0.186747 -1.861992 0.767717 0.429318 0.105461 0.547036 0.811328 -0.822423 -0.382053 0.705315 -0.974523 -1.858241 -0.683019 0.906471 1.568833 -1.482996 1.764961 -2.091923 0.229849 -0.390448 -0.204892 -0.130726 -0.431159 -0.176487 -0.304045 -0.460044 -2.499165 0.582342 -0.803418
2 1.576010 0.213512 0.196293 0.742063 1.002011 0.122067 -0.715647 1.217003 -2.711181 2.123266 -0.906933 0.481079 -1.600381 1.560809 -0.540698 0.703045 -1.068208 -0.239397 -1.728728 1.833070 -0.125199 1.169839 -0.134230 -0.969730 -1.593962 0.805841 0.646978 0.476324 -1.180433 1.404341 -1.009958 0.862758 -0.175115 0.063846 0.298344 -0.101201 -0.126019 0.468479 -2.268641 0.946344 -2.588531 -0.257281 1.773012 -0.286091 -1.207308 -0.810543 -0.191094 -0.156904 -0.641881 0.122624 -0.145774 0.466503 -0.042572 -0.417851 -0.319500 1.583533 1.455609 0.377842 1.072149 0.382536 2.230577 1.138067 0.787231 1.974585 -1.274825 -0.780177 0.087543 2.260153 -1.328528 1.088132 -1.614793 -0.846243 -0.178480 -1.463313 0.656801 -0.523161 0.241717 -0.002255 1.288010 0.294528 0.915077 -0.263558 -0.173300 0.329240 0.318693 0.410095 -1.350227 -0.737364 -0.209551 -0.541511 0.555564 1.621250 -2.721328 -1.083957 -0.000066 1.038064 -0.678462 -0.578955 0.223574 0.542108
3 0.298547 0.824869 0.512646 -0.999925 0.146189 0.152777 -0.920283 1.245638 0.013795 -0.371816 1.456064 -1.995510 0.018740 1.202397 -0.406775 2.470574 -0.924625 1.559281 0.435006 -0.572590 -1.313772 -0.869235 1.155282 1.774353 1.233988 1.067510 -0.705624 -0.396445 0.642462 -0.540838 0.075664 -1.993561 1.550822 -0.144803 1.067782 -0.443478 0.083095 1.111089 -0.208003 -0.951546 -0.778351 -0.253522 -0.065076 -2.856723 2.513168 1.881954 0.649885 0.222268 -0.694688 1.298649 -1.447074 0.376166 0.462074 0.085267 0.370661 -0.918902 -0.637236 2.175857 -0.635965 0.957826 0.475051 0.404583 0.717008 -0.240916 -0.852552 0.392359 1.273237 0.441828 -0.456198 -0.590655 -0.732981 -0.000354 -3.559808 -0.219739 -0.510264 -0.286805 0.937400 0.322958 -0.167773 0.540939 0.378260 -1.011102 -0.047689 1.970831 1.472574 0.309345 0.351591 -1.435713 -0.432529 -1.479943 0.267408 1.766493 0.017985 -0.322720 -0.697095 0.505894 0.686380 -0.496425 -1.670339 -1.145885
1 0 1.271621 -1.159830 -0.367827 -0.064992 1.105721 1.856268 0.662167 -0.511018 1.530508 1.772608 1.299126 -0.461275 -1.696366 0.087969 0.017967 1.332613 -0.772746 1.028709 -0.660664 0.366012 -0.434897 -0.072959 0.127763 1.107404 0.773003 0.601706 0.163765 1.719913 0.676622 -0.257313 0.271995 -0.757851 0.572381 1.809973 0.054161 2.073711 -0.183467 -1.676430 0.110336 0.798336 0.983863 1.257158 -0.415433 -0.584180 -0.793812 -0.787942 0.764188 0.600466 -0.262401 -0.571510 -0.799652 -0.647532 0.026349 1.102770 -1.520363 -0.088483 -2.258425 -1.359185 0.115596 -0.001968 -1.282995 0.088695 0.475944 0.604772 -0.477014 1.546741 -1.031051 -0.618700 -0.107261 -0.285592 -2.439605 -0.332788 1.406889 -0.444392 -0.213132 0.386718 0.137504 -1.826909 0.515202 2.723487 -0.498109 -0.209971 -0.203248 -0.767265 -1.592880 0.524446 -0.194441 0.772585 -0.574805 0.858878 -1.213601 -0.641380 0.825395 1.474640 -0.963665 -0.628147 -0.718927 -1.667628 -1.400814 -0.524568
1 1.738719 -0.441154 -0.448929 -1.340485 1.229392 0.417400 -1.879623 -1.021456 0.102839 -1.010038 0.629501 1.816480 -1.279815 0.783179 0.049650 -0.248037 0.357720 -0.322906 -0.871324 -1.252922 0.469543 0.252219 -0.374560 -0.357495 0.114686 0.202553 1.417213 -0.433225 0.192043 -0.438192 -0.831355 0.754267 -0.161976 2.336599 0.072774 2.924906 -1.353312 -0.141716 -0.906411 -0.058690 -0.056793 -0.456207 0.226592 -0.191032 0.408007 1.495603 1.717670 -0.521257 0.894521 -0.164799 1.720597 0.698328 0.107650 0.978392 0.630105 -0.065848 -0.874300 -0.860216 1.247527 -1.797181 0.496218 0.992693 0.862325 -1.545856 -0.090430 2.221930 -1.070541 1.134470 -0.213806 0.234844 -1.252546 0.004383 -0.642408 -0.249918 0.774327 -0.608889 -2.058531 -0.086104 -0.575355 1.282604 -0.430327 -0.523054 -0.186882 0.785776 0.310116 0.740909 0.861142 -0.733489 -2.244930 0.360489 -1.233589 -1.883096 -0.737884 -0.207911 0.213716 0.827252 0.681588 -0.896414 -1.075361 -0.825029
2 1.044996 0.692316 0.384644 -0.051770 -0.298511 -0.606988 0.312204 0.671455 -0.141112 -1.071149 0.000656 1.068888 -1.047554 0.908138 -0.427666 1.332109 -0.673132 -0.802198 -0.905120 -0.840035 -0.231115 -1.429483 0.422021 -1.307206 -0.585949 1.204710 1.362472 1.208445 -0.798050 1.348073 0.815744 1.014867 -0.522346 1.573319 -0.506486 1.737177 2.067355 1.998778 -2.408936 -1.095832 -0.336498 -1.040157 0.388705 -0.315109 -1.295965 -0.144538 0.665512 -0.702945 0.137219 0.441509 0.304910 0.291220 -0.959751 1.501350 -0.663847 -0.306189 -0.255546 -0.620767 2.100039 -0.149089 1.145631 -0.264820 0.916629 1.405432 0.124977 0.965540 0.039965 0.409051 -0.017570 -0.051115 -1.778561 -0.121807 -0.626631 -0.298387 1.622041 -1.492464 0.883603 1.510035 -0.114490 0.534471 -0.245338 -1.019371 1.804513 -0.823718 1.064522 -0.551903 -0.423464 -1.529049 1.035620 0.272147 0.824748 -1.746354 -0.579221 1.620628 0.300801 -1.246426 0.727242 1.141597 0.516424 -2.011539
3 -0.468820 0.845869 -0.695326 0.156099 0.075335 1.003049 0.871648 0.552319 -0.165694 0.607980 0.086737 -0.962688 0.802992 0.232286 -0.078780 -0.360448 -0.979407 0.514983 -1.670835 -1.708527 0.723783 1.161391 -1.263555 0.474210 -0.850859 -0.186226 -0.295921 1.476390 0.515721 0.433982 1.288720 0.172582 0.815724 0.620133 1.436939 -0.766889 -0.155319 -0.008878 -0.979132 1.356751 -0.114329 0.995627 -0.676055 0.853969 0.216067 0.884942 -0.683134 -1.119623 -2.397936 -0.220054 0.432647 0.704128 0.172798 0.295799 -0.434542 -0.350360 1.139858 1.962625 -1.417939 0.488562 3.803138 0.279159 1.261923 -1.159713 0.296024 -1.044325 0.393871 -0.845619 2.136807 0.607101 0.006529 -0.837212 0.705280 0.725924 1.461486 -0.165782 -0.441158 -1.501317 -0.471740 -0.650353 -0.209744 -0.889705 0.147578 -0.000493 1.638013 1.397099 0.954961 0.697714 -0.286668 1.031424 -0.104348 0.156840 0.262240 -1.959400 0.529847 -0.043275 0.336954 0.331445 1.281511 -0.953011
B 0 0 -1.453314 0.612335 -1.171802 -0.971456 0.274502 0.031189 -0.634929 0.673977 -0.927006 0.711587 1.686360 1.367336 0.752927 -0.524860 0.741271 -1.168089 -0.553492 -0.678537 1.933123 0.000780 0.524450 -1.304511 -1.263392 -1.120854 -0.886227 0.340394 -0.328539 0.104678 0.094196 -0.969189 -0.664923 0.266588 0.628511 -0.293016 -0.052875 0.708709 0.684284 1.034422 -1.011188 1.057732 1.060111 0.937193 -0.105950 0.724518 -0.717488 -2.503960 0.691398 -0.088852 -0.135786 -0.675231 -1.165092 0.106889 1.177870 -1.795090 -0.511424 -0.860126 1.795865 -1.422583 0.021826 0.062986 0.466063 1.520299 0.914740 0.240719 -1.017812 0.035250 -0.590336 0.770105 1.887721 1.130245 -0.184206 -0.101642 -1.049668 -0.751172 1.079930 -0.499780 -1.420153 1.466831 -0.175345 -0.325039 -0.899004 -1.375455 -1.547480 1.926910 0.583318 -0.168539 0.583246 -2.475059 -0.977054 0.028437 -1.214321 1.287802 -0.115443 2.060938 -0.393896 0.706003 -0.588790 -0.341710 -0.648903 -0.279730
1 0.422962 -0.475221 -0.937977 0.145666 1.443133 -0.991152 -0.091914 0.213404 -0.072444 -0.652027 -1.167426 -1.149394 1.063855 -0.235508 0.106151 0.306850 0.557977 1.645929 -1.040947 1.108716 -1.264326 0.420234 0.456945 -1.392972 -0.229373 0.884551 0.603442 -1.671506 0.215404 1.518509 1.251235 -0.937593 -1.520420 0.655404 0.947070 -1.213073 -0.029504 -0.730421 0.507722 0.222695 1.054942 -0.357569 -0.267634 -0.730186 0.067278 0.047188 -0.234229 -0.071022 0.466400 1.422439 -0.592675 0.390429 0.347389 -0.370213 0.729870 1.404350 0.647656 -1.130028 0.328790 0.033541 0.706916 -0.621035 1.620906 0.502363 -0.309121 -1.199562 1.392549 -0.580157 0.389220 -0.849707 -2.519891 -2.172642 1.197569 0.390339 -0.272466 -0.504875 -1.140800 -1.323652 0.609545 -0.294091 -0.156490 0.659950 0.013895 -0.594796 -0.726853 0.146030 1.690309 -1.540438 0.254557 0.757006 0.148115 -1.340629 -0.086192 -0.731338 0.903720 -1.066485 0.963306 -1.106322 0.425662 0.902445
2 -0.114519 -0.894148 -0.459825 -0.860092 1.311689 0.079045 -0.479313 -1.621942 1.437031 -0.385668 0.031613 1.554631 1.922587 1.236762 -1.405548 0.431296 -0.559671 -1.364335 1.540470 -1.037891 -0.597251 -1.760970 1.323680 -0.040624 1.416378 0.268867 -1.190237 -2.654244 0.145487 -0.702713 -0.450625 0.639246 -1.810351 -0.314353 0.029589 1.559145 0.831224 -1.467716 1.149116 0.678701 -1.087049 -0.156583 0.281969 0.444402 -2.735974 0.777399 -0.913128 1.135609 0.552108 0.529568 0.878176 -0.630275 -0.234488 1.071864 0.270741 1.423565 -0.921559 0.469450 0.816461 -0.315021 -0.509505 0.422543 0.199622 -0.352079 -0.043215 0.049431 0.851145 -0.946093 -1.241886 -0.406384 1.205410 0.977493 -0.328764 0.308588 -0.944233 0.354703 1.506549 -1.178986 0.683246 -0.069212 0.837496 -0.855581 1.061181 -0.818939 -0.201744 -1.424031 -2.005628 0.441544 0.481565 -0.945458 1.107691 -0.172908 2.345848 -0.111594 -1.989486 1.939888 0.319370 0.975037 -0.097224 1.078297
3 0.330142 -0.328254 -1.221838 -1.269376 0.224936 0.227021 -0.548239 -0.762316 -0.973061 0.518709 -0.527207 -0.449732 0.616511 -0.138508 3.198323 -1.319831 -0.784321 -0.109539 0.618631 -0.448134 -0.441965 -0.158661 0.289629 -0.189733 -0.307065 -0.291252 -0.919723 0.235367 -0.823842 0.644163 -0.120481 -0.674044 0.025188 -2.017352 0.379046 0.002661 1.449565 -0.258305 0.080453 0.009994 1.373161 0.269563 -0.810022 0.827566 2.752748 -0.802385 -0.262637 -0.968753 0.452533 -0.217648 -0.715118 -0.346238 0.251452 0.150876 -0.997276 2.288353 0.772134 -0.552757 -1.574335 -0.109573 0.283184 0.170267 0.886723 -1.419065 1.914170 -1.309158 -0.080089 -0.251110 -1.171525 0.037911 0.322459 0.197777 -0.685264 -0.835540 0.315409 -1.019272 1.524578 0.641609 -0.582057 -1.186687 -0.759745 1.256577 -0.295763 0.077067 -1.834309 -0.965947 2.098982 -0.060648 -2.042329 0.822987 -0.204282 -0.268995 -0.753873 -0.865595 0.778283 0.056421 0.316427 0.999691 0.253092 -2.717522
1 0 -0.846883 1.088415 0.967920 0.258755 0.265582 0.012232 -0.666982 0.922427 -0.918957 0.069970 -1.526399 -1.409129 -0.365136 0.215126 -1.077997 -2.824267 1.299711 0.109801 -1.157422 1.466051 0.278512 -0.313396 2.000706 -0.164004 1.292563 -0.481441 -0.625945 2.386083 -1.073331 -0.919847 0.273371 0.740276 -1.627254 -2.264990 0.549464 -0.437419 0.021899 -1.414839 0.475264 -1.252686 0.225895 0.193909 0.742424 -0.260078 -0.160746 -0.563300 0.203487 -0.359127 -0.302271 0.979820 -1.120143 0.837676 -0.740377 -0.328891 -1.014987 1.581354 -1.092886 -1.666442 -1.629098 1.682786 0.310351 -1.869990 0.868058 -0.373100 -0.075077 0.066393 -2.278655 0.122150 0.632003 0.151166 0.044748 -0.947692 0.270455 0.729812 1.725512 0.976314 1.592523 -1.251940 0.353285 -0.062702 1.536321 -0.519282 -1.478657 -0.474936 -0.553759 0.436588 -0.380319 -1.128249 -0.776177 -0.596621 -1.509469 -0.995901 -0.397505 1.937808 -0.504975 -0.136662 1.144279 1.408784 0.329938 -0.028275
1 0.248844 -0.218974 -0.071643 0.368139 -1.070780 -0.623872 -0.635629 -1.691887 -0.031015 -1.627739 -2.621537 0.540086 0.446637 0.687632 -0.417413 0.972174 0.557299 -1.688046 0.245621 -0.284546 1.320204 2.172738 -0.747426 -3.685258 -0.288012 -2.225766 -0.302286 1.216289 -0.419170 0.398227 -1.287898 -0.460300 -1.338945 -0.025897 -1.421152 -2.537259 -0.576472 0.621518 0.567446 -0.381906 0.423227 -0.800904 -0.728574 -0.934542 -1.556739 1.444975 2.088553 0.222842 0.656209 0.943792 -0.969268 0.466893 -0.746502 -0.809478 -0.033042 -0.583621 -0.647378 -1.429976 -1.242151 -1.753911 -1.290154 2.237371 -1.804242 0.243330 -0.472571 -1.319793 -0.719148 -0.196199 1.265077 -0.050200 1.462782 -1.130182 -0.345671 1.507173 1.709100 -0.684275 -1.086032 0.077486 1.226397 -1.505153 -0.530095 -0.468825 -2.847749 0.435266 -0.271925 -0.670908 0.163867 -0.038963 -1.174849 0.234607 -0.019082 -0.529796 0.421387 -0.157535 -0.773554 -0.542554 -0.331403 -0.232122 -0.314965 -1.427148
2 -0.024855 -0.864636 1.361465 -2.518439 0.266323 -0.857684 -0.446798 0.827839 0.853931 1.206435 1.195348 0.754382 0.410549 0.460601 -1.492723 -0.472887 0.221844 0.223056 -0.272553 0.105953 -0.376823 -0.062042 0.746071 0.073972 -1.158661 -1.319432 1.693726 -2.415959 -0.383715 0.875836 -1.431599 -1.450521 -0.892497 -0.061629 -0.812381 -0.478105 0.866245 -0.142157 0.671916 -0.536043 0.047047 0.708118 0.403622 1.475821 -0.388899 -1.150930 -1.473945 -1.426369 -0.805201 0.481545 0.765946 0.947186 -0.092220 -0.400624 -0.977419 -0.975950 1.437554 -0.374364 -0.293493 -1.242880 1.476015 -0.646517 0.584418 -0.035440 1.027793 -0.306856 -0.980410 -1.292335 -0.197264 0.761683 -0.125107 -1.266669 0.360353 0.040397 -0.139646 0.293440 -1.936339 1.007051 1.290662 -0.012852 0.379994 1.125760 -2.083607 0.559012 2.045096 1.443455 -0.107501 2.813161 -0.179650 -0.039739 1.128465 -0.664811 0.841462 1.649220 1.124831 0.539864 0.821340 1.162697 -1.002219 -0.188915
3 1.268193 -0.287539 1.140507 0.513849 0.662740 -2.131653 0.377494 1.526189 -0.037946 0.205866 -0.640551 -0.254418 0.158571 0.424106 2.002669 0.376517 1.850075 -0.436817 -1.121320 -0.494273 0.441487 -0.017660 1.475113 0.310859 0.484127 -0.941437 0.386181 -0.724098 -2.424132 0.561293 -0.126692 -0.150997 0.800927 0.248560 0.497716 0.344143 -0.005570 1.056254 0.186671 -1.282178 -0.412316 0.848519 0.322449 0.434829 -0.901592 1.447751 0.415275 -0.944157 1.548943 -1.065513 0.890376 -1.427710 -0.412390 0.658563 -0.263738 -2.024084 0.201932 0.756936 -1.479275 -0.230510 -2.098163 0.712164 1.374913 0.044925 -1.218930 -0.122238 -0.402380 1.760504 -0.659674 0.012305 0.242876 1.615002 -0.187015 -0.219576 0.270323 -0.140648 0.873571 -0.192200 0.514712 -0.972114 1.903829 -0.613942 -0.778432 -0.274667 -0.265174 -0.001520 0.340878 0.208749 -0.853453 -2.186549 -0.426222 -0.960384 -1.047784 1.862331 0.848629 -0.035442 0.414738 -1.867455 -0.966280 1.000283

9.1.2. Styling

def magnify():
    return [dict(selector="th",
                 props=[("font-size", "4pt")]),
            dict(selector="td",
                 props=[('padding', "0em 0em")]),
            dict(selector="th:hover",
                 props=[("font-size", "12pt")]),
            dict(selector="tr:hover td:hover",
                 props=[('max-width', '200px'),
                        ('font-size', '12pt')])
]

np.random.seed(25)
cmap = cmap=sns.diverging_palette(5, 250, as_cmap=True)
bigdf = pd.DataFrame(np.random.randn(20, 25)).cumsum()

bigdf.style.background_gradient(cmap, axis=1)\
    .set_properties(**{'max-width': '80px', 'font-size': '1pt'})\
    .set_caption("Hover to magnify")\
    .set_table_styles(magnify())
Hover to magnify
  0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
0 0.228273 1.026890 -0.839585 -0.591182 -0.956888 -0.222326 -0.619915 1.837905 -2.053231 0.868583 -0.920734 -0.232312 2.152957 -1.334661 0.076380 -1.246089 1.202272 -1.049942 1.056610 -0.419678 2.294842 -2.594487 2.822756 0.680889 -1.577693
1 -1.747981 1.560230 -1.130455 -1.104701 1.025738 0.003675 -2.459820 3.445575 -1.664939 1.268315 -0.515258 -0.015310 1.519518 -1.088040 -1.863166 -1.132030 -0.683069 -0.806861 0.351129 -0.055050 1.791890 -2.820239 2.257219 0.784284 0.440715
2 -0.653732 3.222665 -1.757908 0.516498 2.203870 -0.371203 -3.004149 3.733337 -1.870759 2.458303 0.213669 -0.237350 -0.103188 -0.775499 -3.023587 -0.818470 -0.211071 -0.228999 0.856536 -0.681538 1.445521 -4.886181 3.026155 1.913150 0.607639
3 -1.620988 3.714661 -2.308765 0.431804 4.171439 -0.433878 -3.855285 4.159857 -2.148320 1.080358 0.118473 0.596289 -0.887942 0.270645 -3.669371 -2.710049 -0.308404 -1.587895 1.354846 -1.828858 0.909000 -5.802670 2.814007 2.105995 0.284955
4 -3.348641 4.478728 -1.863451 -1.703772 5.191803 -1.021275 -3.807248 4.720027 -0.724127 1.077167 -0.179294 0.829012 -0.215989 -1.075636 -4.271094 -2.879245 -0.966785 -1.783919 1.532398 -1.796564 2.212258 -6.342154 3.343925 2.488792 2.085578
5 -0.835023 4.233717 -1.654723 -2.004623 5.344795 -0.990296 -4.132202 3.942754 -1.061569 -0.943343 1.240477 0.087122 -1.775907 -0.109346 -4.453389 -0.851705 -2.057086 -1.353887 0.801447 -1.632429 1.539048 -6.510822 2.802080 2.136327 3.774363
6 -0.742661 5.354728 -2.105947 -1.132570 4.202655 -1.849968 -3.201510 3.764827 -3.219971 -1.232603 0.335696 0.574738 -1.817876 0.540041 -4.434264 -1.829508 -4.029952 -2.620025 -0.199518 -4.682319 1.933769 -8.458161 3.335411 2.515490 5.814434
7 -0.435425 4.685541 -2.302523 -0.209710 5.929903 -2.625028 -1.834755 5.458698 -4.502776 -3.164846 -1.727800 0.179197 0.107779 0.036326 -5.992569 -0.449496 -6.199288 -3.889734 0.705826 -3.945140 0.673408 -7.256618 2.967961 3.394341 6.658520
8 0.916429 5.801350 -3.332729 -0.653992 5.987326 -3.187774 -1.830254 5.632341 -3.532148 -1.297564 -1.607920 0.819819 -2.445732 -0.403640 -6.055523 -0.516571 -6.595947 -3.484149 -0.043367 -4.599056 0.506327 -5.846181 3.227209 2.404915 5.075509
9 0.376610 5.536388 -4.489246 -0.801407 7.050450 -2.638456 -0.442983 5.346094 -1.958536 -0.334609 -0.800901 0.257086 -3.369133 -0.817936 -6.051681 -2.613163 -8.454623 -4.452364 0.413516 -4.709704 1.892156 -6.928920 2.137670 3.000518 5.156884
10 2.060955 5.841548 -3.898911 -0.978667 7.780829 -2.490799 -0.593360 5.589822 -2.221739 -0.712894 -0.460900 1.801778 -2.789647 0.483587 -5.966297 -3.440078 -7.774100 -5.486767 -0.697201 -4.610612 -0.519246 -7.724329 1.540940 5.017456 5.807623
11 1.855296 4.474482 -2.167637 -1.379254 5.903561 -0.493331 0.017455 5.784527 -1.043477 -0.602371 0.486087 1.959712 -1.469682 1.882571 -5.916993 -4.546449 -8.150600 -3.424959 -2.243608 -4.333677 -1.165976 -7.898138 1.364929 5.307307 5.831837
12 3.185193 4.223344 -3.060307 -2.265861 5.927409 -2.644635 0.334465 6.721082 -2.836873 -0.195052 1.893613 2.628929 -1.533384 0.748152 -5.273227 -4.530257 -7.565627 -2.852125 -2.169530 -4.781844 -1.133386 -8.994666 2.110373 6.419506 5.598108
13 2.311778 4.454278 -3.865717 -2.049095 6.763108 -3.254570 -2.169981 7.989809 -2.560643 -0.795488 0.712662 2.334485 -0.160684 -0.461331 -5.095010 -3.790941 -7.579271 -4.000575 0.327317 -3.669284 -1.048012 -8.706202 2.470084 5.871868 6.711746
14 3.776661 4.326652 -3.880724 -1.581459 6.218718 -3.234565 -1.464375 5.569291 -2.934611 -0.327696 -0.972011 1.718296 3.613457 0.287798 -4.206806 -4.098502 -6.683742 -4.503725 -2.194553 -2.428166 -1.639656 -9.364028 3.360458 6.110140 7.534624
15 5.643632 5.311834 -3.977693 -2.258677 5.908270 -3.296217 -1.029720 5.682457 -3.057448 -0.330941 -1.160598 2.193163 4.200311 1.009660 -3.223671 -4.306914 -5.735806 -4.436561 -2.295107 -1.361200 -1.203956 -11.272952 2.586907 6.690612 5.914432
16 4.075839 4.339518 -2.441356 -3.304695 6.036980 -2.515758 -0.470885 5.280210 -4.843205 1.582830 0.229670 0.099199 5.785316 1.798015 -3.134796 -3.853625 -5.526188 -2.974892 -2.130464 -1.145860 -0.556230 -13.125711 2.072853 6.162077 4.935564
17 5.639779 4.567669 -3.533112 -3.755907 6.575382 -2.580044 -0.749446 6.577283 -4.778264 3.633654 -0.287753 0.555648 5.764089 2.045579 -2.265157 -2.314014 -4.953443 -3.160439 -3.061884 -2.425741 0.840436 -12.573104 3.557741 7.356074 4.698601
18 5.990735 5.821280 -2.846417 -4.150237 7.124746 -3.322755 -1.214789 7.929950 -4.853968 1.435960 -0.626733 0.352030 7.465647 0.874774 -1.517952 -2.087865 -4.228000 -2.548817 -2.456205 -2.891122 1.897258 -9.736592 3.431567 7.069366 4.387275
19 4.031716 6.229280 -4.098862 -4.105298 7.190747 -4.101052 -1.518843 6.529479 -5.209717 -0.235366 0.007198 1.156140 6.431527 -1.972977 -2.639055 -1.657322 -5.199643 -3.254875 -2.872984 -1.654209 1.643452 -10.660801 2.834048 7.483650 3.937078

9.2. GeoJson with deck.gl rendering

"""
GeoJsonLayer
===========

Property values in Vancouver, Canada, adapted from the deck.gl example pages. Input data is in a GeoJSON format.

Reference: https://deckgl.readthedocs.io/en/latest/gallery/geojson_layer.html
"""

import pydeck as pdk

DATA_URL = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/examples/geojson/vancouver-blocks.json"
LAND_COVER = [[[-123.0, 49.196], [-123.0, 49.324], [-123.306, 49.324], [-123.306, 49.196]]]

INITIAL_VIEW_STATE = pdk.ViewState(latitude=49.254, longitude=-123.13, zoom=11, max_zoom=16, pitch=45, bearing=0)

polygon = pdk.Layer(
    "PolygonLayer",
    LAND_COVER,
    stroked=False,
    # processes the data as a flat longitude-latitude pair
    get_polygon="-",
    get_fill_color=[0, 0, 0, 20],
)

geojson = pdk.Layer(
    "GeoJsonLayer",
    DATA_URL,
    opacity=0.8,
    stroked=False,
    filled=True,
    extruded=True,
    wireframe=True,
    get_elevation="properties.valuePerSqm / 20",
    get_fill_color="[255, 255, properties.growth * 255]",
    get_line_color=[255, 255, 255],
)

r = pdk.Deck(layers=[polygon, geojson], initial_view_state=INITIAL_VIEW_STATE)

r.to_html()

9.3. Interactive visualisations

plotly below, but Altair / Vega also available

# https://plotly.com/python/getting-started/

import plotly.io as pio
import plotly.express as px

df = px.data.iris()
fig = px.scatter(df, x="sepal_width", y="sepal_length", color="species", size="sepal_length")
fig

9.4. .obj 3d object rendering

#  http://www2.compute.dtu.dk/projects/GEL/PyGEL/

from pygel3d import hmesh, gl_display as gl
from pygel3d import jupyter_display as jd

m = hmesh.load("data/bunny.obj")

jd.set_export_mode(True)
jd.display(m, smooth=False)

9.5. PDF rendering

from IPython.display import HTML
fpth = "../_data/BMSDataDrivenWaterfall_resize.pdf"
HTML(f"""
<div class="admonition note" name="html-admonition" style="background: lightgreen; padding: 10px">
<p class="title">This is an example of an embedded pdf</p>
<iframe src="{fpth}" width="100%" height="800px" frameBorder="0"> </iframe>
""")

This is an example of an embedded pdf